<#import "../common/layout.ftl" as layout>
<#import "../common/common.ftl" as common>
<#import "../common/spring.ftl" as spring>

<@layout.head></@layout.head>
<@layout.body>
<#--页面主要内容-->
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            <@spring.message code="sso_app_title"/>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i><@spring.message code="sso_app"/></a></li>
            <li><a href="#"><@spring.message code="sso_app_title"/></a></li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
            <#--tab 主画面-->
                <div class="active tab-pane" id="app">
                    <div class="box">
                    <#--检索-->
                        <div class="box-header">
                            <div class="form-horizontal">
                                <div class="box-body">
                                    <form role="form" action="${request.contextPath}/app/appinfo" method="get">
                                        <div class="form-group">
                                            <div class="col-sm-3">
                                                <label for="appId"
                                                       class="control-label"><@spring.message code="sso_app_id"/></label>
                                                <input type="text" class="form-control" name="appId"
                                                       value="${appParam.appId!}" maxlength="16">
                                            </div>
                                            <div class="col-sm-3">
                                                <label for="appName"
                                                       class="control-label"><@spring.message code="sso_app_name"/></label>
                                                <input type="text" class="form-control" name="appName"
                                                       value="${appParam.appName!}" maxlength="32">
                                            </div>
                                            <br>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-6 col-sm-offset-6">
                                                <button type="submit" class="btn btn-info col-xs-offset-1 pull-right">
                                                    <@spring.message code="com_oper_select"/>
                                                </button>
                                                <button id="app_add" type="button"
                                                        class="btn btn-default col-xs-offset-1 pull-right"
                                                        data-toggle="modal"
                                                        data-target="#modal-add">
                                                    <@spring.message code="com_oper_add"/>
                                                </button>
                                            </div>
                                        </div>
                                </div>
                            </div>
                        </div>
                    <#--检索内容-->
                        <div class="box-body" id="app_table">
                <#if !ssoAppList?? || ssoAppList?size == 0>
                    <div class="callout callout-info">
                        <h4><@spring.message code="sso_no_date_title"/></h4>
                        <p><@spring.message code="sso_no_date_desc"/></p>
                    </div>
                <#else >
                        <table class="table table-bordered table-hover console_data_table"
                               style="table-layout:fixed;word-break:break-all;word-wrap:break-word;border-collapse:collapse;vertical-align:middle;">
                            <thead>
                            <tr>
                                <th style="width: 3em;"><@spring.message code="sso_app_id"/></th>
                                <th style="width: 3em;"><@spring.message code="sso_app_name"/></th>
                                <th style="width: 10em;"><@spring.message code="sso_app_desc"/></th>
                                <th style="width: 2em;"><@spring.message code="com_oper"/></th>
                            </tr>
                            </thead>
                            <tbody>
                    <#list ssoAppList as ssoApp>
                    <tr>
                        <td style="width: 3em;">${ssoApp.appId}</td>
                        <td style="width: 3em;">${ssoApp.appName}</td>
                        <td style="width: 10em;">${ssoApp.appIntroduction}</td>
                        <td style="width: 2em;">
                            <button class="btn btn-info btn-xs" type="button"
                                    onclick="appModify('${ssoApp.id}', '${ssoApp.appId}', '${ssoApp.appName}','${ssoApp.appIntroduction}')"><@spring.message code="com_oper_modify"/></button>
                            <button class="btn btn-danger btn-xs" type="button"
                                    onclick="appDelete('${ssoApp.id}', '${ssoApp.appId}', '${ssoApp.appName}')"><@spring.message code="com_oper_delete"/></button>
                        </td>
                    </tr>
                    </#list>
                            </tbody>
                        </table>
                </#if>
                        </div>
                    </div>
                </div>
            <#--tab 主画面-->


            <#--新增弹框-->
                <div class="modal fade" id="modal-add">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" style="text-align: center"
                                    id="pop_app_title"><@spring.message code="sso_add_app"/></h4>
                            </div>
                            <div class="modal-body">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label><@spring.message code='sso_app_id'/></label>
                                        <input id="pop_appid" type="text" class="form-control"
                                               placeholder="<@spring.message code='sso_app_id_tips'/>"
                                               maxlength="16">
                                    </div>
                                    <div class="form-group">
                                        <label><@spring.message code='sso_app_name'/></label>
                                        <input id="pop_appname" type="text" class="form-control"
                                               placeholder="<@spring.message code='sso_app_name_tips'/>"
                                               maxlength="32">
                                    </div>
                                    <div class="form-group">
                                        <label><@spring.message code='sso_app_desc'/></label>
                                        <textarea id="pop_app_desc" class="form-control" rows="3"
                                                  placeholder="<@spring.message code='sso_app_desc_tips'/>"
                                                  maxlength="512"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default pull-left"
                                        data-dismiss="modal"><@spring.message code='com_oper_close'/>
                                </button>
                                <button type="button" class="btn btn-primary ajax" data-dismiss="modal"
                                        id="pop_app_btn"><@spring.message code='com_oper_add'/>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            <#--新增弹框-->

            <#--更新弹框-->
                <button type="button" id="btn_update" class="btn btn-info"
                        data-toggle="modal" data-target="#modal-update" style="display: none;">
                    Launch Info Modal
                </button>
                <div class="modal fade" id="modal-update">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" style="text-align: center"
                                    id="pop_modify_title"><@spring.message code="sso_modify_app"/></h4>
                            </div>
                            <div class="modal-body">
                                <div class="box-body">
                                    <div class="form-group">
                                        <input id="pop_modify_id" type="text" style="display: none;" disabled>
                                        <label><@spring.message code='sso_app_id'/></label>
                                        <input id="pop_modify_appid" type="text" class="form-control"
                                               placeholder="<@spring.message code='sso_app_id_tips'/>"
                                               maxlength="16" disabled>
                                    </div>
                                    <div class="form-group">
                                        <label><@spring.message code='sso_app_name'/></label>
                                        <input id="pop_modify_appname" type="text" class="form-control"
                                               placeholder="<@spring.message code='sso_app_name_tips'/>"
                                               maxlength="32">
                                    </div>
                                    <div class="form-group">
                                        <label><@spring.message code='sso_app_desc'/></label>
                                        <textarea id="pop_modify_app_desc" class="form-control" rows="3"
                                                  placeholder="<@spring.message code='sso_app_desc_tips'/>"
                                                  maxlength="512"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default pull-left"
                                        data-dismiss="modal"><@spring.message code='com_oper_close'/>
                                </button>
                                <button type="button" class="btn btn-primary ajax" data-dismiss="modal"
                                        id="pop_modify_app_btn"><@spring.message code='com_oper_update'/>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            <#--更新弹框-->

            </div>
        <@common.pop_msg_box/>
    </section>
</div>
</@layout.body>
<@layout.footer>
<script src="${request.contextPath}/static/js/webconsole/app/appinfo.js"></script>
<#-- 自定义js编写 -->
</@layout.footer>